perm filename FCHISQ.F4[3,ALS] blob
sn#041469 filedate 1973-05-13 generic text, type T, neo UTF8
function fchisq(y,sigmay,npts,nfree,mode,yfit)
implicit double precision (a-h,o-z)
dimension y(100),sigmay(100),yfit(100)
11 chisq=0.
12 if (nfree) 13,13,20
13 fchisq=0.
goto 40
20 do 30 i=1,npts
21 if (mode) 22,27,29
22 if (y(i)) 25,27,23
23 weight=1./y(i)
goto 30
25 weight=1./(-y(i))
goto 30
27 weight=1.
goto 30
29 weight=1./sigmay(i)**2
30 chisq=chisq+weight*(y(i)-yfit(i))**2
31 free=nfree
32 fchisq=chisq/free
40 return
end